<%@ page pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/base/taglibs.jsp"%>
<html>
	<head>
		<link href="${ctx}/css/main.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="${ctx}/js/My97DatePicker/WdatePicker.js"></script>
		<script language="javascript">
			function submitAction(action){
				document.searchForm.action = action ;
				document.searchForm.submit();
			}
			
			function init() {
				document.getElementById("newsTitle").value = "";
				document.getElementById("newsSort").value = "";
				document.getElementById("timeFrom").value = "";
				document.getElementById("timeTo").value = "";
			}
			
			function select(action,id){
				location.href = "${ctx}/" + action + "?id=" + id;
			}
		
			function doDelete(action,id){
				if(confirm('是否确认删除？')){
					location.href = "${ctx}/" + action + "?id=" + id ;
				}
			}
		</script>
	</head>
	
	<body>
		<form method="post" action="" name="searchForm">
			<table border="0" cellspacing="1" cellpadding="3" align="center" width="100%">
				<tr>
					<td width="20%" class="td2">
						新闻标题
					</td>
					<td width="30%" class="td2">
						<input type="text" name="newsTitle" size="32" value="${news.newsTitle}">
					</td>
					<td width="20%" class="td2">
						新闻种类
					</td>
					<td width="30%" class="td2">
						<select name="newsSort" id="newsSort" style="width:200px">
							<option value=""></option>
							<c:forEach var="code" items="${sessionScope.T_newsSortList}">
								<c:if test="${news.newsSort == code.newsSort}">
									<option value="${code.newsSort}" selected="selected">${code.newsSortName}</option>
								</c:if>
								<c:if test="${news.newsSort != code.newsSort}">
									<option value="${code.newsSort}">${code.newsSortName}</option>
								</c:if>
							</c:forEach>
						</select>
					</td>
				</tr>
				<tr>
					<td width="20%" class="td2">
						发布时间（起）
					</td>
					<td width="30%" class="td2">
						<input size="28" readonly="readonly" id="timeFrom" type="text" name="timeFrom" value="${news.timeFrom}"/>
						<img onclick="WdatePicker({el:'timeFrom'})" src="${ctx}/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
					</td>
					<td width="20%" class="td2">
						发布时间（止）
					</td>
					<td width="30%" class="td2">
						<input size="28" readonly="readonly" id="timeTo" type="text" name="timeTo" value="${news.timeTo}"/>
						<img onclick="WdatePicker({el:'timeTo'})" src="${ctx}/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
					</td>
				</tr>
				<tr>
					<td class="td11" align="left" colspan="4">
						<input type="button" name="search" value="查询" onClick="submitAction('newsPublishSearch.ac')">
						&nbsp;&nbsp;<input type="button" name="new" value="新增" onClick="submitAction('newNewsPublish.ac')">
						&nbsp;&nbsp;<input type="button" name="reset" value="重置" onClick="init()">
					</td>
				</tr>
			</table>
			<BR>
			<table border="0" cellspacing="1" cellpadding="3" align="center" width="100%">
				<tr>
					<td width="10%" class="td1" align="center">
						动作
					</td>
					<td width="48%" class="td1" align="center">
						新闻标题
					</td>
					<td width="10%" class="td1" align="center">
						新闻种类
					</td>
					<td width="10%" class="td1" align="center">
						发布时间
					</td>
					<td width="12%" class="td1" align="center">
						最后修改时间
					</td>
					<td width="10%" class="td1" align="center">
						删除
					</td>
				</tr>
				<c:forEach var="news" items="${newsList}">
					<tr>
						<td class="td2" align="center">
							<a href="javascript:select('selectNews.ac','${news.id}');">选择</a>
						</td>
						<td class="td2">
							${news.newsTitle}
						</td>
						<td class="td2" align="center">
							${news.newsSortName}
						</td>
						<td class="td2" align="center">
							${news.publishDate}
						</td>
						<td class="td2" align="center">
							${news.updateTime}
						</td>
						<td class="td2" align="center">
							<img src="${ctx}/images/delete0.png" onclick="javascript:doDelete('deleteNews.ac','${news.id}');">
						</td>
					</tr>
				</c:forEach>
			</table>
		</form>
	</body>
</html>